package com.controller;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.vo.PostVo;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
public class IndexController extends BaseController{

    @GetMapping({"/","","index"})
    @ApiOperation("首页预览和分页信息")
    public IPage<PostVo> index(){
        IPage<PostVo> pageDatas = postService.paging(getPage(), null, null, null, null, "created");
        List<PostVo> records = pageDatas.getRecords();
        for (PostVo post:
             records) {
            System.out.println(post.getAuthorName());
        }
        return pageDatas;
    }
}
